package com.cdd.index.controller;

import com.cdd.index.service.IBannerService;
import com.common.entity.Banner;
import com.common.entity.HeadNav;
import com.common.untils.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author lzl
 * @since 2022-09-05
 */
@RestController
@RequestMapping("/index/banner")
public class BannerController {
    @Autowired
    private IBannerService bannerService;
    @PostMapping("/selectAll/{currentPage}/{pageSize}")
    public CommonResult selectAll(@PathVariable Integer currentPage, @PathVariable Integer pageSize, @RequestBody Banner banner){
        return bannerService.selectAll(currentPage,pageSize,banner);
    }
    @PostMapping("/findAll")
    public CommonResult findAll(){
        return bannerService.findAll();
    }

    @PostMapping("/updateStatus/{id}/{isDisable}")
        public CommonResult updateStatus(@PathVariable String id,@PathVariable String isDisable){
        System.out.println("-------------------"+isDisable);
        return bannerService.updateStatus(id,isDisable);
    }
    @PostMapping("/bannerAdd")
    public CommonResult bannerAdd(@RequestBody Banner banner){
        return bannerService.bannerAdd(banner);
    }

    @PostMapping("/deleteBanner/{id}")
    public CommonResult deleteBanner(@PathVariable String id){
        return bannerService.deleteBanner(id);
    }
    @PostMapping("/updateBanner")
    public CommonResult updateBanner(@RequestBody Banner banner){
        return bannerService.updateBanner(banner);
    }
}